<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/jsp/comm_css_include.jsp"%>
<!doctype html>
<html>
<head>
<style type="text/css">
	#tabb {
    overflow: hidden;
    zoom: 1;
    border-bottom: 1px solid #e7eaec;
    border-top: 1px solid #e7eaec;
    height: 44px;
}

</style>
</head>
<body class="gray-bg">
	<!-- 隐藏域 -->
	<input type="hidden" id="openDate"/>
	<input type="hidden" id="openCardStatus"/>
	<input type="hidden" id="hzicbcOpenCardStatus"/>
	<input type="hidden" id="opencardSubmitTime"/>
	<input type="hidden" id="openCardSubId"/>
	<input type="hidden" id="openCardId"/>
	<!-- 隐藏域 -->
	<div class="container creditbody">
		<div class="iboxtitle">
			<span><i class="glyphicon glyphicon-map-marker"></i>&nbsp;贷中业务>贷中信息登记>银行放款</span>
			<a href="javascript:void(0)"></a>
		</div>
		<div class="ibox-content ibox-con">
			<div class="buttonfixed" style="display: none;">
				<button type="button" class="btn dpbtn_blue" id="baocun" style="display: none;" onclick="save();">保存</button>
				<button type="button" class="btn dpbtn_blue" id="xiugai" style="display: none;" onclick="save();">修改</button>
				<button type="button" class="btn dpbtn_blue"  name="allocation" onclick="allocation();">提交审核</button>
			</div>
			<%@include file="/jsp/auto_yw_info_include.jsp"%>
			<form  id="commentForm">
				 <div class="business-manwife">卡片信息</div>
				 <div class="business-padding">
					  <table cellpadding="0" cellspacing="0" border="0" class="buyinfor-table">
							<tr>	
								<td align="right">
									<label class="control-label np">发证机关：</label>
								</td>
								<td colspan="3">
									<input class="form-control" type="text" id="authref" name="authref" required="required" placeholder="发证机关(必填)" />
								</td>
							</tr>
							<tr>		
								<td align="right">
									<label class="control-label np">主卡发送移动电话：</label>
								</td>
								<td>
									<input class="form-control" type="text" maxlength="11" id="mamobile" name="mamobile" required="required" placeholder="主卡发送移动电话(必填)" />
								</td>
								
								<td align="right">
									<label class="control-label np">发送短信帐单手机：</label>
								</td>
								<td>
									<input class="form-control" type="text" maxlength="11" id="smsphone" name="smsphone" required="required" placeholder="手机号码(必填)" />
								</td>
							</tr>
							<tr>	
								<td align="right">
									<label class="control-label np">卡片领取方式：</label>
								</td>
								<td>
									<select class="form-control" disabled="disabled" required="required"  id="drawmode" name="drawmode" ></select>
								</td>
								<td align="right">
									<label class="control-label np">对帐单寄送方式：</label>
								</td>
								<td>
									<select class="form-control" required="required"  id="accgetm" name="accgetm" ></select>
								</td>
							</tr>
							<tr>	
								<td align="right">
									<input id="accaddrf" type="hidden" >
									<label class="control-label np">开通email对账单：</label>
								</td>
								<td >
									<select class="form-control" required="required" id="emladdrf" name="emladdrf"></select>
								</td>
								<td align="right" class="emladdrf">
									<label class="control-label np">对帐单EMAIL：</label>
								</td>
								<td class="emladdrf">
									<input class="form-control" type="text" id="stmtemail" name="stmtemail" required="required" placeholder="对帐单EMAIL(必填)" />
								</td>
							</tr>
							<tr>	
								<td align="right">
									<label class="control-label np">主卡开通余额变动提醒：</label>
								</td>
								<td >
									<select class="form-control" required="required" id="machgf" name="machgf"></select>
								</td>
								<td align="right" class="machgf">
									<label class="control-label np">主卡余额提醒发送手机：</label>
								</td>
								<td class="machgf">
									<input class="form-control" type="text" maxlength="11" id="machgmobile" name="machgmobile" required="required" placeholder="手机号码(必填)" />
								</td>
							</tr>
						</table>
					</div>
					
					<div class="business-manwife">基本信息</div>
					<div class="business-padding">
						<table cellpadding="0" cellspacing="0" border="0" class="buyinfor-table">
							<tr>	
								<td align="right">
									<label class="control-label np">证件类型：</label>
								</td>
								<td>
									<input class="form-control" type="text"  placeholder="证件类型" value="身份证" readonly="readonly" />
									<input type="hidden" id="custsort" name="custsort">
								</td>
								
								<td align="right">
									<label class="control-label np">身份证号码：</label>
								</td>
								<td>
									<input class="form-control" type="text" id="custcode" name="custcode" placeholder="身份证号码 " readonly="readonly"  />
								</td>
								<td align="right">
									<label class="control-label np">出生日期：</label>
								</td>
								<td>
									<input class="form-control" type="text" id="birthdate" name="birthdate" required="required" placeholder="出生日期(必填)" readonly="readonly" />
								</td>
							</tr>
							<tr>
								<td align="right">
									<label class="control-label np">证件是否长期：</label>
								</td>
								<td>
									<select id="longTimeOrNot" class="form-control">
										<option value="0">不是长期</option>
										<option value="1">长期有效</option>
									</select>
								</td>	
								<td align="right">
									<label class="control-label np">证件有效期：</label>
								</td>
								<td>
									<input class="laydate-icon form-control"  type="text " id="statdate" name="statdate" required="required" placeholder="证件有效期(必填)" onclick="laydate({istime: false, format: 'YYYY-MM-DD'});" />
								</td>
							</tr>
							<tr>	
								<td align="right">
									<label class="control-label np">姓名：</label>
								</td>
								<td>
									<input class="form-control" type="text" readonly="readonly" id="chnsname" name="chnsname" required="required" placeholder="姓名 " />
								</td>
								<td align="right">
									<label class="control-label np">英文/拼音：</label>
								</td>
								<td>
									<input class="form-control"  type="text" id="engname" name="engname" required="required" placeholder="英文/拼音(必填)" />
								</td>
							</tr>
							<tr>	
								<td align="right">
									<label class="control-label np">手机号1：</label>
								</td>
								<td>
									<input class="form-control" type="text" maxlength="11" id="mvblno" name="mvblno" required="required" placeholder="手机号1(必填)" onblur="changephoneNo(this);" onafterpaste="changephoneNo(this);"  />
								</td>
								<td align="right">
									<label class="control-label np">手机号1归属地：</label>
								</td>
								<td class="locationAbout">
									<input class="form-control" type="text" id="mvblArea" name="mvblArea" readonly="readonly" required="required" placeholder="手机号1归属地(必填)" />
								</td>
								<td align="right">
									<label class="control-label np">婚否：</label>
								</td>
								<td>
									<select class="form-control" required="required" id="mrtlstat" name="mrtlstat"></select>
								</td>
							</tr>
							<tr>	
								<td align="right">
									<label class="control-label np">教育程度：</label>
								</td>
								<td>
									<select class="form-control" required="required" id="edulvl" name="edulvl"></select>
								</td>
								<td align="right">
									<label class="control-label np">住宅状况：</label>
								</td>
								<td>
									<select class="form-control" required="required"  id="homestat" name="homestat" ></select>
								</td>
								<td align="right">
									<label class="control-label np">住宅邮编：</label>
								</td>
								<td>
									<input class="form-control" type="text" maxlength="6" id="homezip" name="homezip" required="required" placeholder="住宅邮编(必填)" />
								</td>
							</tr>
							<tr>	
								<td align="right">
									<label class="control-label np">住宅地址：</label>
								</td>
								<td>
									<input class="form-control smalliconcur smallicon" type="text" id="liveAddr"  required="required" readonly="readonly" onclick="cityChoice(this);" placeholder="住宅地址(必填)" />
									<input type="hidden" id="hprovince" />
									<input type="hidden" id="hcity" />
									<input type="hidden" id="hcounty" />
								</td>
								<td colspan="2">
									<input class="form-control" type="text" id="haddress" name="haddress" required="required" placeholder="住宅详细地址(必填)" />
								</td>
								<td align="right">
									<label class="control-label np">何时入住现址：</label>
								</td>
								<td>
									<input class="laydate-icon form-control" type="text" id="indate" name="indate" required="required" placeholder="何时入住现址(必填)" onclick="laydate({istime: false, format: 'YYYY-MM-DD'});" />
								</td>
							</tr>
							<tr>	
								<td align="right">
									<label class="control-label np">通讯地址：</label>
								</td>
								<td>
									<input class="form-control smalliconcur smallicon" type="text" id="commaddra" name="commaddr" required="required" readonly="readonly" onclick="cityChoice(this);" placeholder="通讯地址(必填)" />
									<input type="hidden" id="commprov" />
									<input type="hidden" id="commcity" />
									<input type="hidden" id="commcounty" />
								</td>
								<td colspan="2">
									<input class="form-control" type="text" id="commaddr" name="commaddr" required="required" placeholder="通讯详细地址(必填)" />
								</td>
								<td align="right">
									<label class="control-label np">通讯地址邮编：</label>
								</td>
								<td>
									<input class="form-control" type="text" maxlength="6" id="commazip" name="commazip" required="required" placeholder="通讯地址邮编(必填)" />
								</td>
							</tr>
						</table>
					</div>
					<div class="business-manwife">在职情况</div>
					<div class="business-padding">
						<table cellpadding="0" cellspacing="0" border="0" class="buyinfor-table">
							<tr>	
								<td align="right">
									<label class="control-label np">单位名称：</label>
								</td>
								<td>
									<input class="form-control" type="text" id="company" name="company"  placeholder="单位名称(必填)"  />
								</td>
								<td align="right">
									<label class="control-label np">进入单位时间：</label>
								</td>
								<td>
									<input class="laydate-icon form-control" type="text" id="joindate" name="joindate" required="required" placeholder="进入单位时间(必填)" onclick="laydate({istime: false, format: 'YYYY-MM-DD'});" />
								</td>
							</tr>
							<tr>	
								<td align="right">
									<label class="control-label np">单位地址：</label>
								</td>
								<td>
									<input class="form-control smalliconcur smallicon" placeholder="单位地址(必填)" required="required" type="text" id="caddressa"  readonly="readonly" onclick="cityChoice(this);" name="caddress" placeholder="单位地址"  />
									<input type="hidden" id="cprovince" />
									<input type="hidden" id="ccity" />
									<input type="hidden" id="ccounty" />
								</td>
								<td colspan="2">
									<input class="form-control" type="text"  id="caddress" name="caddress" required="required" placeholder="单位详细地址(必填)"  />
								</td>
							</tr>
							<tr>	
								<td align="right">
									<label class="control-label np">单位邮编：</label>
								</td>
								<td>
									<input class="form-control" type="text" maxlength="6" id="corpzip" name="corpzip" required="required" placeholder="单位邮编(必填)"  />
								</td>
								<td align="right">
									<label class="control-label np">单位性质：</label>
								</td>
								<td>
									<select class="form-control" required="required" id="modelcode" name="modelcode"> </select>
								</td>
							</tr>
							
							<tr>	
								<td align="right">
									<label class="control-label np">单位电话：</label>
								</td>
								<td>
									<input class="form-control" type="text" id="cophoneno" name="cophoneno" required="required" placeholder="单位电话(必填)"  />
								</td>
								<td align="right">
									<label class="control-label np">职务：</label>
								</td>
								<td>
									<select class="form-control" required="required" id="occptn" name="occptn"> </select>
								</td>
							</tr>
							<tr>	
								<td align="right">
									<label class="control-label np">年收入(元)：</label>
								</td>
								<td>
									<input class="form-control" type="number" min="0"  id="yearincome" name="yearincome" required="required" placeholder="年收入(必填)"  />
								</td>
							</tr>
						</table>	
					</div>
					<div class="business-manwife">基本信息</div>
					<div class="business-padding">
						<table cellpadding="0" cellspacing="0" border="0" class="infor-table">
							<tr>	
								<td align="right">
									<label class="control-label np">紧急联络人1：</label>
								</td>
								<td>
									<div class="control-div np" id="reltname1"></div>
								</td>
								<td align="right">
									<label class="control-label np">手机号：</label>
								</td>
								<td>
									<div class="control-div np" id="reltmobl1" ></div>
								</td>
								<td align="right">
									<label class="control-label np">关系：</label>
								</td>
								<td>
									<div class="control-div np" id="reltship1Display" ></div>
									<input id="reltship1" type="hidden" />
								</td>
								<td align="right">
									<label class="control-label np">性别：</label>
								</td>
								<td>
									<select class="form-control select-control-tebie" id="reltsex1" >
										<option value="1">男</option>
										<option value="2">女</option>
									</select>
								</td>
							</tr>
							<tr>
								<td colspan="10">&nbsp;</td>
							</tr>
							<tr>	
								<td align="right">
									<label class="control-label np">紧急联络人2：</label>
								</td>
								<td>
									<div class="control-div np" id="reltname2" ></div>
								</td>
								<td align="right">
									<label class="control-label np">手机号：</label>
								</td>
								<td>
									<div class="control-div np" id="reltmobl2" ></div>
								</td>
								<td align="right">
									<label class="control-label np">关系：</label>
								</td>
								<td>
									<div class="control-div np" id="reltship2Display" ></div>
									<input id="reltship2" type="hidden" />
								</td>
								<td align="right">
									<label class="control-label np">性别：</label>
								</td>
								<td>
									<select class="form-control select-control-tebie" id="reltsex2" >
										<option value="1">男</option>
										<option value="2">女</option>
									</select>
								</td>
							</tr>
							
						</table>
					</div>
					<div class="business-manwife">其他信息</div>
					<div class="business-padding">
						<table cellpadding="0" cellspacing="0" border="0" class="buyinfor-table">
							<!-- <tr>	
								<td align="right">
									<label class="control-label np">自动还款转出帐户类型1：</label>
								</td>
								<td colspan="3">
									<select class="form-control" type="text" id="outacctype" name="outacctype"></select>
								</td>
							</tr> -->
							<tr>	
								<td align="right">
									<label class="control-label np">转出卡号/帐号1：</label>
								</td>
								<td>
									<input class="form-control" type="text" id="outcardno1" maxlength="20" name="outcardno1" placeholder="转出卡号/帐号1" />
								</td>
								<td align="right">
									<label class="control-label np">提前还款天数：</label>
								</td>
								<td>
									<input class="form-control" type="text" min="0" max="23" maxlength="2" id="paydays" name="paydays"  placeholder="提前还款天数" />
								</td>
							</tr>
						</table>
					</div>	
					<div class="business-manwife">贷款信息</div>
					<div class="business-padding">
						<table cellpadding="0" cellspacing="0" border="0" class="infor-table">
							<tr>	
								<td align="right">
									<label class="control-label np">申请分期金额：</label>
								</td>
								<td>
									<div class="control-div" id="loanAmount">-</div>
								</td>
								<td align="right">
									<label class="control-label np">贷款期限(月)：</label>
								</td>
								<td>
									<div class="control-div" id="loanMonth">-</div>
								</td>
							</tr>
							<tr>	
								<td align="right">
									<label class="control-label np">手续费率：</label>
								</td>
								<td>
									<div class="control-div" id="bankRate">-</div>
								</td>
								<td align="right">
									<label class="control-label np">手续费：</label>
								</td>
								<td>
									<div class="control-div" id="stagesFee">-</div>
								</td>
							</tr>
							<tr>	
								<td align="right">
									<label class="control-label np">购车价：</label>
								</td>
								<td>
									<div class="control-div" id="carPrice">-</div>
								</td>
							</tr>
						</table>
					</div>	
				</form>
				<div class="business-manwife">备注信息</div>
				<div class="business-padding">
					<table cellpadding="0" cellspacing="0" border="0" class="infor-table">
						<tr>	
							<td align="right">
								<label class="control-label np">备注信息：</label>
							</td>
							<td>
								<div class="control-div" id="backReasonText">-</div>
							</td>
						</tr>
					</table>
				</div>
				<div class="business-manwife">经办信息</div>
				<div class="padding-nono">
					<table cellpadding="0" cellspacing="0" border="0"
						class="buyinfor-table">
						<tr>
							<td align="right"><label class="control-label np">经办人：</label>
							</td>
							<td><input class="form-control" type="text" id="operate" name="" readonly="readonly" value="${current_user_key.uname}" />
							</td>
							<td align="right"><label class="control-label np">经办时间：</label>
							</td>
							<td><input id="operateTime" name="operateTime" class="form-control"  placeholder="经办时间" readonly="readonly"/></td>
						</tr>
					</table>

				</div>
		</div>
		
		<%@include file="/jsp/comm_js_include.jsp"%>
		<%@include file="/jsp/comm_js_region_include_choice.jsp"%>
		<script src="${basePath}/js/plugins/layer/laydate/laydate.js"></script>
		<script src="${basePath}/js/yw/autoOpenCardApply.js?v=${empty cssVersion ? Math.random() : cssVersion }"></script>
		
		<script type="text/javascript">
		    $(function(){	
		    	getYwicbcOpenCard();
		    	getshujuData();
			});	
	    	
		   function getOtherData(){
				$.dpAjax({
				  show:false,
		          url: '${basePath}/YwBusinessCommonController/getCommonBusinessInfo',
		          data: {"busiId":$.getUrlData("busiId")},
		          success: function (datas) {
		        	  var ywBusinessBuyer = datas.ywBusinessBuyer;
		        	  var ywBusinessLoan =  datas.ywBusinessLoan;
		        	  if(ywBusinessLoan!=null){
		        		  $("#loanAmount").text(ywBusinessLoan.loanAmount);
			          	  $("#loanMonth").text(ywBusinessLoan.loanMonthDisplay);
			          	  $("#bankRate").text(showNumber((ywBusinessLoan.bankRate ? ywBusinessLoan.bankRate : 0 ) * 100, 4));
			          	  $("#stagesFee").text(showNumber(ywBusinessLoan.stagesFee));
			          	  $("#carPrice").text(showNumber(ywBusinessLoan.carPrice));
			          }
		        	  if(ywBusinessBuyer != ""){
		        		  $("#reltname1").text(ywBusinessBuyer.contact1);
			          	  $("#reltmobl1").text(ywBusinessBuyer.contact1Tel1);
			          	  $("#reltname2").text(ywBusinessBuyer.contact2);
			          	  $("#reltmobl2").text(ywBusinessBuyer.contact2Tel1);
			          	  $("#reltship1").val(ywBusinessBuyer.contact1Relation);
			          	  $("#reltship2").val(ywBusinessBuyer.contact2Relation);
			          	  $("#reltship1Display").text(ywBusinessBuyer.contact1RelationDisplay);
			          	  $("#reltship2Display").text(ywBusinessBuyer.contact2RelationDisplay);
			          	  $("#mamobile").val(ywBusinessBuyer.tel1);
			          	  $("#smsphone").val(ywBusinessBuyer.tel1);
			              $("#cophoneno").val(ywBusinessBuyer.companyTel);
			              $("#yearincome").val(ywBusinessBuyer.companyIncome);
			              $("#company").val(ywBusinessBuyer.company);
			              getData();
		        	  }else{
		        		  getData();
		        	  }
		          }
				})  
			}
				
		    function getshujuData(){
				//获取数据字典
		    	$.dpAjax({
		    		show:false,
			    	url:'${basePath}/DataDictionaryController/getEnableList',
		 			data:{},
		 			success: function(datas){
		 				  var result = datas.result.rows;
		 				  var machgf='<option value="">请选择</option>';
		 				  var emladdrf='<option value="">请选择</option>';
		 				  var edulvl='<option value="">请选择</option>';
		 				  var homestat='<option value="">请选择</option>';
		 				  var modelcode='<option value="">请选择</option>';
		 				  var mrtlStat='<option value="">请选择</option>';
		 				  var drawmode='<option value="">请选择</option>';
		 				  var accgetm='<option value="">请选择</option>';
		 				  var occptn='<option value="">请选择</option>';
					      for(var i=0;i<result.length;i++){
					    	  if(result[i].parentValue == "HZICBC_Machgf"){
					    		  machgf +='<option value="'+result[i].value+'">'+result[i].name+'</option>'
					    	  }
					    	  if(result[i].parentValue == "HZICBC_Eml_Addrf"){
					    		  emladdrf +='<option value="'+result[i].value+'">'+result[i].name+'</option>'
					    	  }
					    	  if(result[i].parentValue == "HZICBC_Edu_Lvl"){
					    		  edulvl +='<option value="'+result[i].value+'">'+result[i].name+'</option>'
					    	  }
					    	  if(result[i].parentValue == "HZICBC_Home_Stat"){
					    		  homestat +='<option value="'+result[i].value+'">'+result[i].name+'</option>'
					    	  }
					    	  if(result[i].parentValue == "HZICBC_Model_Code"){
					    		  modelcode +='<option value="'+result[i].value+'">'+result[i].name+'</option>'
					    	  }
					    	  if(result[i].parentValue == "HZICBC_Mrtl_Stat"){
					    		  mrtlStat +='<option value="'+result[i].value+'">'+result[i].name+'</option>'
					    	  }
					    	  if(result[i].parentValue == "HZICBC_Draw_Mode"){
					    		  drawmode +='<option value="'+result[i].value+'">'+result[i].name+'</option>'
					    	  }
					    	  if(result[i].parentValue == "HZICBC_Acc_Getm"){
					    		  accgetm +='<option value="'+result[i].value+'">'+result[i].name+'</option>'
					    	  }
					    	  if(result[i].parentValue == "Job"){
					    		  occptn +='<option value="'+result[i].value+'">'+result[i].name+'</option>'
					    	  }
					      } 
					      $("#machgf").html(machgf);
					      $("#emladdrf").html(emladdrf);
					      $("#edulvl").html(edulvl);
					      $("#homestat").html(homestat);
					      $("#modelcode").html(modelcode);
					      $("#mrtlstat").html(mrtlStat);
						  $("#drawmode").html(drawmode);
						  $("#occptn").html(occptn);
						  $("#drawmode").val("1");
						  $("#accgetm").html(accgetm);
						  getOtherData();
						  getData();
						  return;
		             }
			    });
			}
		    
	    	$("#emladdrf").change(function(){
				  var objVal = $(this).val();
			      if(objVal == 0){
			    	  $(".emladdrf").hide();
			    	  $("#stmtemail").val("-");
			      }else{
			    	  $(".emladdrf").show();
			    	  $("#stmtemail").val("");
			      }; 
			});
		    
	    	$("#machgf").change(function(){
				  var objVal = $(this).val();
			      if(objVal == 0){
			    	  $(".machgf").hide();
			    	  $("#machgmobile").val("-");
			      }else{
			    	  $(".machgf").show();
			    	  $("#machgmobile").val("");
			      }; 
			}); 
		    
	    	$("#longTimeOrNot").change(function(){
				  var objVal = $(this).val();
			      if(objVal == 0){
			    	  $("#statdate").val("");
			    	  $("#statdate").attr("onclick","laydate({istime: false, format: 'YYYY-MM-DD'})");
			      }else{
			    	  $("#statdate").removeAttr("onclick");
			    	  $("#statdate").val("9999-12-30");
			      }; 
			}); 
	    	
		  //手机号码归属地
	 		function changephoneNo(obj){
		 		var $phoneArea = $(obj).parents("td").siblings(".locationAbout").find("input");
				var phone = obj.value;
				if(!phone || phone == ''){
					return;
				}
				$.dpAjax({
					show:false,
			    	url:'${basePath}/PhoneNumberAddrController/getAddressByPhoneNumber',
		 			data:{phoneCode:phone},
		 			success: function(datas){
		 				  var result = datas.result;
			 			  if(result && result != null){
			 				  var resultLocation = result.showapi_res_body;
							  var city = resultLocation.city;
							  if(city && city != ""){
								  $phoneArea.val(city);
								  $("#mvblArea").attr("readonly","readonly");
							  }else{
								  $phoneArea.val("");
								  $("#mvblArea").removeAttr("readonly","readonly");
							  }
			 			  }else{
			 				 $phoneArea.val("");
			 				$("#mvblArea").removeAttr("readonly","readonly");
						  }
		              }
		      	});
		    }
		  
	 		function showPhodata(phone){
				if(!phone || phone == ''){
					return;
				}
				$.dpAjax({
					show:false,
			    	url:'${basePath}/PhoneNumberAddrController/getAddressByPhoneNumber',
		 			data:{phoneCode:phone},
		 			success: function(datas){
		 				  var result = datas.result;
			 			  if(result && result != null){
			 				  var resultLocation = result.showapi_res_body;
							  var city = resultLocation.city;
							  if(city && city != ""){
								  $("#mvblArea").val(city);
								  $("#mvblArea").attr("readonly","readonly");
							  }else{
								  $("#mvblArea").removeAttr("readonly","readonly");
							  }
			 			  }else{
			 				 $("#mvblArea").removeAttr("readonly","readonly");
						  }
		              }
		      	});
	 		}
		    
		    /* 省市区默认选择 */
		 	var hujilayer,objid,objidPhone;
		 	
		 	function cityChoice(obj){
		 		selectProvincesLayer(null,function(){
		 			$selectedProvice = $("#provincechioce").children("li:eq(0)")
		 			$selectedProvice.addClass("proactive"); 
		 			selectCitiesLayer("110000000000",null, function(){
		 				$("#citychioce").children("li:eq(0)").addClass("proactive"); 
			 			selectAreasLayer("110100000000");
			    	});
		 		});
		 		objid = $(obj).attr("id");
		 		 
		 		hujilayer = layer.open({
		 			type:1,
		 			title:"省市选择",
		 			area: ['650px', '500px'], //宽高
		 			content: $("#areaChoice")
		 		});
		 	};
		 	
		 	function areachoiceone(obj){
		 		var province = $("#provincechioce").find("li.proactive").text();
		 		var city = $("#citychioce").find("li.proactive").text();
		 		var area = $(obj).text();
		 		var text = province + city + area;
		 		if(objid=="liveAddr"){
		 			$("#liveAddr").val(text);
		 			$("#hprovince").val(province);
		 			$("#hcity").val(city);
		 			$("#hcounty").val(area);
		 		}else if(objid=="commaddra"){
		 			$("#commaddra").val(text);
		 			$("#commprov").val(province);
		 			$("#commcity").val(city);
		 			$("#commcounty").val(area);
		 		}else if(objid=="caddressa"){
		 			$("#caddressa").val(text);
		 			$("#cprovince").val(province);
		 			$("#ccity").val(city);
		 			$("#ccounty").val(area);
		 		}
		 		layer.close(hujilayer);
		 	} 
		 	
		 	
		 	function getData(){
		 		var data={};
	 	 		data.busiId=$.getUrlData("busiId");
		 		$.dpAjax({
	    			show:false,
		    		url:'${basePath}/YwOpenCardHzicbcSubController/list',
		    		data: data,
	    			success: function(datas){
	    				var data = datas.result.rows;
    					if(data.length>0){
    						var result=data[0];
    						if(result.openCardStatus !=50){
    							$(".buttonfixed").show();
    							$("#xiugai").show();
        						$("#baocun").hide();
    						}
    						$("#openCardSubId").val(result.replaceId);
    						$("#openCardId").val(result.openCardId);
		    				$("#authref").val(result.authref);
		    				$("#mamobile").val(result.mamobile);
		    				$("#smsphone").val(result.smsphone);
		    				$("#drawmode").val(result.drawmode);
		    				$("#accgetm").val(result.accgetm);
		    				$("#emladdrf").val(result.emladdrf);
		    				if(result.emladdrf == 0){
					    	  $(".emladdrf").hide();
					    	  $("#stmtemail").val("-");
					        }else{
					    	  $(".emladdrf").show();
					    	  $("#stmtemail").val(result.stmtemail);
					        };
		    				
		    				$("#machgf").val(result.machgf);
		    				if(result.machgf == 0){
					    	  $(".machgf").hide();
					    	  $("#machgmobile").val("-");
					        }else{
					    	  $(".machgf").show();
			    			  $("#machgmobile").val(result.machgmobile);
					        };
		    				
		    				$("#custsort").val(result.custsort);
		    				$("#custcode").val(result.custcode);
		    				$("#birthdate").val(result.birthdate);
		    				$("#mrtlstat").val(result.mrtlstat);
		    				$("#edulvl").val(result.edulvl);
		    				$("#mrtlstat").val(result.mrtlstat);
		    				$("#mvblno").val(result.mvblno);
		    				showPhodata(result.mvblno);
		    				$("#mvblArea").val(result.mvblArea);
		    				$("#statdate").val(formateToDate(result.statdate));
		    				if(formateToDate(result.statdate)=="9999-12-30"){
		    					$("#longTimeOrNot").val("1");
		    					$("#statdate").removeAttr("onclick");
		    				}
		    				$("#homestat").val(result.homestat);
		    				$("#homezip").val(result.homezip);
		    				var hprovince = result.hprovince;
		    				var hcity = result.hcity;
		    				var hcounty = result.hcounty;
		    				$("#hprovince").val(hprovince);
				 			$("#hcity").val(hcity);
				 			$("#hcounty").val(hcounty);
		    				$("#liveAddr").val(hprovince+hcity+hcounty);
		    				$("#haddress").val(result.haddress);
		    				$("#indate").val(result.indate);
		    				var commprov = result.commprov;
		    				var commcity = result.commcity;
		    				var commcounty = result.commcounty;
		    				$("#commprov").val(commprov);
				 			$("#commcity").val(commcity);
				 			$("#commcounty").val(commcounty);
		    				$("#commaddra").val(commprov+commcity+commcounty);
		    				$("#commaddr").val(result.commaddr);
		    				$("#commazip").val(result.commazip);
		    				
		    				$("#joindate").val(result.joindate);
		    				var cprovince = result.cprovince;
		    				var ccity = result.ccity;
		    				var ccounty = result.ccounty;
		    				$("#cprovince").val(cprovince);
				 			$("#ccity").val(ccity);
				 			$("#ccounty").val(ccounty);
		    				$("#caddressa").val(cprovince+ccity+ccounty);
		    				$("#caddress").val(result.caddress);
		    				$("#corpzip").val(result.corpzip);
		    				$("#modelcode").val(result.modelcode);
		    				$("#cophoneno").val(result.cophoneno);
		    				$("#occptn").val(result.occptn);
		    				$("#yearincome").val(result.yearincome);
		    				$("#workAge").val(result.workAge);
		    				$("#outcardno1").val(result.outcardno1);
		    				$("#paydays").val(result.paydays);
		    				
		    				$("#reltsex1").val(result.reltsex1);
		    				$("#reltsex2").val(result.reltsex2);
		    				$("#operate").val(result.creatorName);
		    				$("#operateTime").val(formateIntegerDate(result.created));
		    				$("#company").val(result.ccol1);
		    				$("#engname").val(result.engname);
		    				
	    				}else{
	    					$(".buttonfixed").show();
    						$("#xiugai").hide();
    						$("#baocun").show();
    						$("#operateTime").val(laydate.now());
    					}	
	                 }
		    	});
		 	} 
		 	
		    var getYwicbcOpenCard=function(){
		    	var data={};
		    	data.busiId=$.getUrlData("busiId");
		    	$.dpAjax({
		    			show:false,
			    		url:'${basePath}/YwOpenCardHzicbcController/selectRefined',
			    		data:data,
		    			success: function(datas){
		    				  $("#backReasonText").text(datas.result.reasonBack);
							  $("#openDate").val(datas.openDate);
							  $("#openCardStatus").val();
							  $("#hzicbcOpenCardStatus").val();
							  $("#opencardSubmitTime").val();
							  $("#reasonBack").val();
							  return;
		                 }
			    	});
		    }
		    
		    //保存
	    	var save = function(callback){
		    	var data={};
		    	var url='${basePath}/YwOpenCardHzicbcController/insert';
		    	if($("#openCardSubId").val()!=""){
		    		data.id=$("#openCardSubId").val();
		    		url='${basePath}/YwOpenCardHzicbcController/update';
			    	data.openCardId=$("#openCardId").val();
		    	}
		    	//工行主表
		    	data.busiId=$.getUrlData("busiId");
		    	data.cusId=$.getUrlData("cusId");
		    	data.openDate=$("#openDate").val();
		    	data.openCardStatus=$("#openCardStatus").val();
		    	data.hzicbcOpenCardStatus=$("#hzicbcOpenCardStatus").val();
		    	data.opencardSubmitTime=$("#opencardSubmitTime").val();
		    	data.reasonBack=$("#reasonBack").val();
		    	//子表
		    	data.chnsname=$("#chnsname").val();
		    	data.custcode=$("#custcode").val();
		    	data.custsort="1";
		    	data.mrtlstat=$("#mrtlstat").val();
		    	data.edulvl=$("#edulvl").val();
		    	data.mvblno=$("#mvblno").val();
		    	data.authref=$("#authref").val();
		    	data.mamobile=$("#mamobile").val();
		    	data.smsphone=$("#smsphone").val();
		    	data.drawmode=$("#drawmode").val();
		    	data.accgetm=$("#accgetm").val();
		    	data.accaddrf="1";
		    	data.emladdrf=$("#emladdrf").val();
		    	data.stmtemail=$("#stmtemail").val();
		    	data.machgf=$("#machgf").val();
		    	data.machgmobile=$("#machgmobile").val();
		    	data.birthdate=$("#birthdate").val();
		    	data.statdate=$("#statdate").val();
		    	data.engname=$("#engname").val();
		    	data.homestat=$("#homestat").val();
		    	data.homezip=$("#homezip").val();
		    	data.indate=$("#indate").val();
		    	data.commaddr=$("#commaddr").val();
		    	data.commazip=$("#commazip").val();
		    	data.joindate=$("#joindate").val();
		    	data.modelcode=$("#modelcode").val();
		    	data.outacctype=$("#outacctype").val();
		    	data.outcardno1=$("#outcardno1").val();
		    	data.paydays=$("#paydays").val();
		    	data.corpzip=$("#corpzip").val();
		    	data.cophoneno=$("#cophoneno").val();
		    	data.reltname1=$("#reltname1").text();
		    	data.reltmobl1=$("#reltmobl1").text();
		    	data.reltship1=$("#reltship1").val();
		    	data.reltsex1=$("#reltsex1").val();
		    	data.reltname2=$("#reltname2").text();
		    	data.reltsex2=$("#reltsex2").val();
		    	data.reltship2=$("#reltship2").val();
		    	data.reltmobl2=$("#reltmobl2").text();
		    	data.occptn=$("#occptn").val();
		    	data.yearincome=$("#yearincome").val();
		    	
		    	data.hprovince=$("#hprovince").val();
		    	data.hcity=$("#hcity").val();
		    	data.hcounty=$("#hcounty").val();
		    	data.haddress=$("#haddress").val();
		    	
		    	data.commprov=$("#commprov").val();
		    	data.commcity=$("#commcity").val();
		    	data.commcounty=$("#commcounty").val();
		    	data.commaddr=$("#commaddr").val();
		    	
		    	data.cprovince=$("#cprovince").val();
		    	data.ccity=$("#ccity").val();
		    	data.ccounty=$("#ccounty").val();
		    	data.caddress=$("#caddress").val();
		    	
		    	data.ccol1=$("#company").val();
		    	
		    	$.dpAjax({
		    		url:url,
		    		data:data,
	    			success: function(datas){
	    				layer.msg('执行成功！', {icon: 6});
	    				$("#openCardSubId").val(datas.result);
	    				if(callback) {
	    					callback(datas);
	    				}
						return;
	                 }
		    	});
	    	}
	    	
	    	  //提交
	    	var allocation = function(){
	    		var validstatus = $("#commentForm").valid();
   			    if(!validstatus){
   			    	layer.msg("有验证未通过，请仔细检查！",{icon:5});
   			    	return;
   			    }
	    		save(function(){
	    			var data={};
			    	//工行主表
	    			if($("#openCardSubId").val()!=""){
			    		data.id=$("#openCardSubId").val();
			    	}
			    	data.busiId=$.getUrlData("busiId");
			    	data.cusId=$.getUrlData("cusId");
			    	data.openCardId=$("#openCardId").val();
			    	data.openDate=$("#openDate").val();
			    	data.openCardStatus=$("#openCardStatus").val();
			    	data.hzicbcOpenCardStatus=$("#hzicbcOpenCardStatus").val();
			    	data.opencardSubmitTime=$("#opencardSubmitTime").val();
			    	data.reasonBack=$("#reasonBack").val();
			    	//子表
			    	data.chnsname=$("#chnsname").val();
			    	data.custcode=$("#custcode").val();
			    	data.custsort="1";
			    	data.mrtlstat=$("#mrtlstat").val();
			    	data.edulvl=$("#edulvl").val();
			    	data.mvblno=$("#mvblno").val();
			    	data.authref=$("#authref").val();
			    	data.mamobile=$("#mamobile").val();
			    	data.smsphone=$("#smsphone").val();
			    	data.drawmode=$("#drawmode").val();
			    	data.accgetm=$("#accgetm").val();
			    	data.accaddrf="1";
			    	data.emladdrf=$("#emladdrf").val();
			    	data.stmtemail=$("#stmtemail").val();
			    	data.machgf=$("#machgf").val();
			    	data.machgmobile=$("#machgmobile").val();
			    	data.birthdate=$("#birthdate").val();
			    	data.statdate=$("#statdate").val();
			    	data.engname=$("#engname").val();
			    	data.homestat=$("#homestat").val();
			    	data.homezip=$("#homezip").val();
			    	data.indate=$("#indate").val();
			    	data.commaddr=$("#commaddr").val();
			    	data.commazip=$("#commazip").val();
			    	data.joindate=$("#joindate").val();
			    	data.modelcode=$("#modelcode").val();
			    	data.outacctype=$("#outacctype").val();
			    	data.outcardno1=$("#outcardno1").val();
			    	data.paydays=$("#paydays").val();
			    	data.corpzip=$("#corpzip").val();
			    	data.cophoneno=$("#cophoneno").val();
			    	data.reltname1=$("#reltname1").text();
			    	data.reltmobl1=$("#reltmobl1").text();
			    	data.reltship1=$("#reltship1").val();
			    	data.reltsex1=$("#reltsex1").val();
			    	data.reltname2=$("#reltname2").text();
			    	data.reltsex2=$("#reltsex2").val();
			    	data.reltship2=$("#reltship2").val();
			    	data.reltmobl2=$("#reltmobl2").text();
			    	data.occptn=$("#occptn").val();
			    	data.yearincome=$("#yearincome").val();
			    	
			    	data.hprovince=$("#hprovince").val();
			    	data.hcity=$("#hcity").val();
			    	data.hcounty=$("#hcounty").val();
			    	data.haddress=$("#haddress").val();
			    	
			    	data.commprov=$("#commprov").val();
			    	data.commcity=$("#commcity").val();
			    	data.commcounty=$("#commcounty").val();
			    	data.commaddr=$("#commaddr").val();
			    	
			    	data.cprovince=$("#cprovince").val();
			    	data.ccity=$("#commcity").val();
			    	data.ccounty=$("#ccounty").val();
			    	data.caddress=$("#caddress").val();
	  			    
			    	data.ccol1=$("#company").val();
			    	$.dpAjax({
			    		url:'${basePath}/YwOpenCardHzicbcController/commitDaishenheYwOpenCardHzicbc',
			    		data:data,
		    			success: function(datas){
		    				setTimeout(function () {
					 			window.location.href = "${basePath}/web/system/yw/autoOpenCardApplyList.jsp";
					 		}, 3000);
							return;
		                 }
			    	});
	    			
	    		}); 
	    	} 
	    	
	    	var getByBusiId=function(){
	    		var data={};
	    		data.busiId=$.getUrlData("busiId");
	    		$.dpAjax({
		    		url:'${basePath}/YwOpenCardHzicbcController/getByBusiId',
		    		data:data,
	    			success: function(datas){
		    			  if(datas.flag == "100100")
						  {
							  layer.msg('执行成功！', {icon: 6});
							  return;
						  }
						  if(datas.flag == "100200")
		                  {
							  $.fn.showDatas({"datas":datas});
		                	  return;
		                  }
	                 }
			    });
	    	 }
	    	
    </script>
</body>
</html>
